package com.wzy.level.user.userServlet;

import com.wzy.Jdbc封装.pojo.News_user;
import com.wzy.level.user.userService.userService;
import com.wzy.level.user.userServiceImpl.userServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/password")
public class isPass extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("usn");
        String password1 = req.getParameter("password1");
        userService userService = new userServiceImpl();
        News_user news_user1 =null;
        news_user1 = userService.selectByUsername(username);
        resp.setCharacterEncoding("utf-8");
        PrintWriter writer = resp.getWriter();

        if(news_user1.getPassword().equals(password1)){
            writer.println("密码正确");
        }else {
            writer.println("密码不正确");
        }
        writer.flush();
        writer.close();
    }
}
